<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <div>
            {{ time | formatTime }}
        </div>

        <div>{{ fn(time) }}</div>
    </div>
    <script src="./vue.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                time: '时间'
            },
            methods: {
                fn (v) {
                    console.log(v)
                    return 'fn的结果'
                }
            },

            // 过滤器，其实过滤器本质就是一个函数
            // 在Vue3中已经没有过滤器
            filters: {
                formatTime (v) {
                    console.log('调用了', v)
                    return '2022-08-16'
                }
            }
        })
    </script>
</body>
</html>